package common.store.admin.contoller;

import common.store.admin.service.AdminOrderService;
import common.store.admin.service.impl.AdminOrderServiceImpl;
import common.store.admin.service.impl.AdminProductServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/adminOrderDel")
public class AdminOrderDelServlet extends HttpServlet {

    AdminOrderService adminOrderService;

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        String oid = req.getParameter("oid");
        adminOrderService = new AdminOrderServiceImpl();

        Integer rows = adminOrderService.DelOrderByOid(oid);

        if(rows > 0){
            resp.sendRedirect(req.getContextPath() + "/adminOrderList");//刷新页面过程
        }
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }
}
